<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Save Input Data</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        input, button {
            margin: 10px 0;
        }
    </style>
</head>
<body>
    <h2>输入数据保存到本地</h2>
    <input type="text" id="inputData" placeholder="输入一些文本">
    <button onclick="saveData()">保存数据</button>
    <button onclick="loadData()">加载数据</button>
    <script>
        function saveData() {
            var input = document.getElementById('inputData').value;
            localStorage.setItem('savedData', input);
        }

        function loadData() {
            var savedData = localStorage.getItem('savedData');
            if (savedData) {
                document.getElementById('inputData').value = savedData;
            } else {
                alert('没有保存的数据！');
            }
        }
    </script>
</body>
</html>